//
//  APAuthorTableViewCell.m
//  AqualPolo
//
//  Created by dong on 2024/5/9.
//

#import "APAuthorTableViewCell.h"

@implementation APAuthorTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = UIColor.clearColor;
        self.backgroundColor = UIColor.clearColor;
        _avatarImageView = [[UIImageView alloc] init];
        _avatarImageView.layer.cornerRadius = 22;
        _avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
        _avatarImageView.layer.masksToBounds = true;
        [self.contentView addSubview:_avatarImageView];
        [_avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(20);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(44, 44));
        }];
        
        _unfollowButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_unfollowButton setTitle:@"Unfollow" forState:UIControlStateNormal];
        _unfollowButton.titleLabel.font = [LYFont fontWithSize:12 fontName:LYFontNamepfr];
        _unfollowButton.backgroundColor = LYRGBColor(18, 23, 78);
        _unfollowButton.layer.cornerRadius = 15;
        _unfollowButton.layer.masksToBounds = true;
        [self.contentView addSubview:_unfollowButton];
        [_unfollowButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).offset(-20);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(71, 30));
        }];
        
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.textColor = [UIColor whiteColor];
        _nameLabel.font = [LYFont fontWithSize:14 fontName:LYFontNamepfr];
        _nameLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_avatarImageView.mas_right).offset(10);
            make.bottom.equalTo(self.contentView.mas_centerY).offset(-4);
            make.right.equalTo(_unfollowButton.mas_left).offset(-10);
        }];
        
        _contentLabel = [[UILabel alloc] init];
        _contentLabel.textColor = LYRGBAColor(255, 255, 255, 0.6);
        _contentLabel.font = [LYFont fontWithSize:12 fontName:LYFontNamepfr];
        _contentLabel.textAlignment = NSTextAlignmentLeft;
        [self.contentView addSubview:_contentLabel];
        [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_avatarImageView.mas_right).offset(10);
            make.top.equalTo(self.contentView.mas_centerY).offset(4);
            make.right.equalTo(_unfollowButton.mas_left).offset(-10);
        }];
        
        
    }
    return self;
}

@end
